import { defineStore } from 'pinia';
// 组合式
// export const useTalkStore = defineStore('talkList', {
//   actions: {
//     getTalk() {
//       this.talkList.push({ id: '00003', title: '滚蛋吧你！' })
//     }
//   },
//   state() {
//     return {
//       talkList: JSON.parse(localStorage.getItem('list') as string) || []
//     }
//   }
// }) 
// 选项式
import { reactive } from 'vue'
export const useTalkStore = defineStore('talkList', () => {
  const talkList = reactive(JSON.parse(localStorage.getItem('list') as string) || [])
  function getTalk() {
    talkList.push({ id: '00003', title: '滚蛋吧你！' })
  }
  return { talkList, getTalk }
}) 
